﻿<Activity mc:Ignorable="sads sap" x:Class="TfsBuild.Process" this:Process.Verbosity="[Microsoft.TeamFoundation.Build.Workflow.BuildVerbosity.Normal]"
          this:Process.BuildNumberFormat="[&quot;$(BuildDefinitionName)_$(Date:yyyyMMdd)$(Rev:.r)&quot;]" 
          this:Process.SupportedReasons="Manual, BatchedCI, Schedule, ScheduleForced" 
          this:Process.VMWareLabWorkflowParameters="[New VMWareLabWorkflowDetails()]" 
          this:Process.CleanWorkspace="[Microsoft.TeamFoundation.Build.Workflow.Activities.CleanWorkspaceOption.All]" 
          this:Process.AgentSettings="[New Microsoft.TeamFoundation.Build.Workflow.Activities.AgentSettings() With {.MaxWaitTime = New System.TimeSpan(4, 0, 0), .MaxExecutionTime = New System.TimeSpan(0, 0, 0), .TagComparison = Microsoft.TeamFoundation.Build.Workflow.Activities.TagComparison.MatchExactly}]"
 xmlns="http://schemas.microsoft.com/netfx/2009/xaml/activities"
 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
 xmlns:mt="clr-namespace:Microsoft.TeamFoundation;assembly=Microsoft.TeamFoundation.Common, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
 xmlns:mtbc="clr-namespace:Microsoft.TeamFoundation.Build.Client;assembly=Microsoft.TeamFoundation.Build.Client, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
 xmlns:mtbc1="clr-namespace:Microsoft.TeamFoundation.Build.Common;assembly=Microsoft.TeamFoundation.Build.Common, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
 xmlns:mtbw="clr-namespace:Microsoft.TeamFoundation.Build.Workflow;assembly=Microsoft.TeamFoundation.Build.Workflow, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
 xmlns:mtbwa="clr-namespace:Microsoft.TeamFoundation.Build.Workflow.Activities;assembly=Microsoft.TeamFoundation.Build.Workflow, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
 xmlns:mtbwt="clr-namespace:Microsoft.TeamFoundation.Build.Workflow.Tracking;assembly=Microsoft.TeamFoundation.Build.Workflow, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
 xmlns:mtltc="clr-namespace:Microsoft.TeamFoundation.Lab.TestIntegration.Client;assembly=Microsoft.TeamFoundation.Lab.TestIntegration.Client, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
 xmlns:mtlwa="clr-namespace:Microsoft.TeamFoundation.Lab.Workflow.Activities;assembly=Microsoft.TeamFoundation.Lab.Workflow.Activities, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
 xmlns:mtvc="clr-namespace:Microsoft.TeamFoundation.VersionControl.Client;assembly=Microsoft.TeamFoundation.VersionControl.Client, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
 xmlns:mva="clr-namespace:Microsoft.VisualBasic.Activities;assembly=System.Activities"
 xmlns:s="clr-namespace:System;assembly=mscorlib"
 xmlns:sad="clr-namespace:System.Activities.Debugger;assembly=System.Activities"
 xmlns:sads="http://schemas.microsoft.com/netfx/2010/xaml/activities/debugger"
 xmlns:sap="http://schemas.microsoft.com/netfx/2009/xaml/activities/presentation"
 xmlns:scg="clr-namespace:System.Collections.Generic;assembly=mscorlib"
 xmlns:sl="clr-namespace:System.Linq;assembly=System.Core"
 xmlns:this="clr-namespace:TfsBuild"
 xmlns:v="clr-namespace:VMWareLabWorkflowsDataContracts;assembly=VMWareLabWorkflowsDataContracts"
 xmlns:v1="clr-namespace:VMWareActivities;assembly=VMWareActivities"
 xmlns:vv="clr-namespace:VMware.Vim;assembly=VMware.Vim"
 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  <x:Members>
    <x:Property Name="Metadata" Type="mtbw:ProcessParameterMetadataCollection" />
    <x:Property Name="Verbosity" Type="InArgument(mtbw:BuildVerbosity)" />
    <x:Property Name="BuildNumberFormat" Type="InArgument(x:String)" />
    <x:Property Name="SupportedReasons" Type="mtbc:BuildReason" />
    <x:Property Name="VMWareLabWorkflowParameters" Type="InArgument(v:VMWareLabWorkflowDetails)" />
    <x:Property Name="CleanWorkspace" Type="InArgument(mtbwa:CleanWorkspaceOption)" />
    <x:Property Name="AgentSettings" Type="InArgument(mtbwa:AgentSettings)" />
  </x:Members>
  <this:Process.Metadata>
    <mtbw:ProcessParameterMetadataCollection>
      <mtbw:ProcessParameterMetadata Category="VMWare" DisplayName="VMWare Details" Editor="VMWareLabWorkflowsDataContracts.VMWareLabDetailEditor,VMWareLabWorkflowParameters" ParameterName="VMWareLabWorkflowParameters" />
    </mtbw:ProcessParameterMetadataCollection>
  </this:Process.Metadata>
  <sap:VirtualizedContainerService.HintSize>1603,13308</sap:VirtualizedContainerService.HintSize>
  <mva:VisualBasic.Settings>Assembly references and imported namespaces serialized as XML namespaces</mva:VisualBasic.Settings>
  <sap:WorkflowViewStateService.ViewState>
    <scg:Dictionary x:TypeArguments="x:String, x:Object">
      <x:Boolean x:Key="ShouldCollapseAll">False</x:Boolean>
      <x:Boolean x:Key="ShouldExpandAll">True</x:Boolean>
    </scg:Dictionary>
  </sap:WorkflowViewStateService.ViewState>
  <Sequence DisplayName="Application Deployment Workflow" sad:XamlDebuggerXmlReader.FileName="E:\Projects\CodePlex\vmwarelab\VMWareLab2012\Main\TemplatesProject\VMWareLabDefaultTemplate.xaml" sap:VirtualizedContainerService.HintSize="1563,13228" mva:VisualBasic.Settings="Assembly references and imported namespaces serialized as XML namespaces">
    <Sequence.Variables>
      <Variable x:TypeArguments="mtbc:IBuildDetail" Name="BuildDetail" />
      <Variable x:TypeArguments="x:String" Name="LabEnvironmentUri" />
      <Variable x:TypeArguments="x:String" Name="BuildLocation" />
      <Variable x:TypeArguments="x:Int64" Name="SnapshotId" />
      <Variable x:TypeArguments="x:Int32" Name="QueueBuildId" />
      <Variable x:TypeArguments="mtbc:BuildStatus" Default="[Microsoft.TeamFoundation.Build.Client.BuildStatus.Succeeded]" Name="BuildStatus" />
      <Variable x:TypeArguments="mtbc:IBuildDetail" Name="ChildBuildDetail" />
      <Variable x:TypeArguments="mtbc:IBuildDetail" Name="SelectedBuildDetail" />
      <Variable x:TypeArguments="x:String" Name="BuildNumber" />
      <Variable x:TypeArguments="v:AgentInformationNode" Name="RetrievedAgentInformationNode" />
      <Variable x:TypeArguments="x:String" Name="EnvironmentsSummary" />
    </Sequence.Variables>
    <sap:WorkflowViewStateService.ViewState>
      <scg:Dictionary x:TypeArguments="x:String, x:Object">
        <x:Boolean x:Key="IsExpanded">True</x:Boolean>
      </scg:Dictionary>
    </sap:WorkflowViewStateService.ViewState>
    <mtbwa:WriteBuildMessage sap:VirtualizedContainerService.HintSize="1541,22" Importance="[Microsoft.TeamFoundation.Build.Client.BuildMessageImportance.High]" Message="Starting VMWare Lab Build" mva:VisualBasic.Settings="Assembly references and imported namespaces serialized as XML namespaces" />
    <mtbwa:UpdateBuildNumber BuildNumberFormat="[BuildNumberFormat]" DisplayName="Update Build Number" sap:VirtualizedContainerService.HintSize="1541,22" />
    <mtbwa:GetBuildDetail DisplayName="Get Build Details" sap:VirtualizedContainerService.HintSize="1541,22" Result="[BuildDetail]" />
    <If Condition="[VMWareLabWorkflowParameters.BuildDetails.IsTeamSystemBuild = True AndAlso VMWareLabWorkflowParameters.BuildDetails.QueueNewBuild = True]" DisplayName="If Build is needed" sap:VirtualizedContainerService.HintSize="1541,456">
      <sap:WorkflowViewStateService.ViewState>
        <scg:Dictionary x:TypeArguments="x:String, x:Object">
          <x:Boolean x:Key="IsExpanded">False</x:Boolean>
          <x:Boolean x:Key="IsPinned">False</x:Boolean>
        </scg:Dictionary>
      </sap:WorkflowViewStateService.ViewState>
      <If.Then>
        <Sequence DisplayName="Do Build" sap:VirtualizedContainerService.HintSize="264,308">
          <sap:WorkflowViewStateService.ViewState>
            <scg:Dictionary x:TypeArguments="x:String, x:Object">
              <x:Boolean x:Key="IsExpanded">True</x:Boolean>
              <x:Boolean x:Key="IsPinned">False</x:Boolean>
            </scg:Dictionary>
          </sap:WorkflowViewStateService.ViewState>
          <mtlwa:RunWorkflow BuildController="{x:Null}" LabEnvironmentUri="{x:Null}" BuildDefinition="[VMWareLabWorkflowParameters.BuildDetails.BuildDefinitionName]" DisplayName="Start Build Workflow" sap:VirtualizedContainerService.HintSize="242,22" ProjectName="[BuildDetail.TeamProject]" Result="[QueueBuildId]" />
          <mtlwa:WaitForWorkflow AllowPartiallySucceededBuild="True" BuildDetails="[ChildBuildDetail]" DisplayName="Wait For Build To Complete" sap:VirtualizedContainerService.HintSize="242,22" LabWorkflowType="[Microsoft.TeamFoundation.Lab.Workflow.Activities.WorkflowType.Build]" MaxConsecutiveFailuresToIgnoreDuringWaitForCompletion="[3]" MaxWaitTime="[TimeSpan.Zero]" QueueBuildId="[QueueBuildId]" RefreshInterval="[System.TimeSpan.FromMinutes(1)]" Result="[BuildStatus]" ThrowOnError="True" />
          <Assign DisplayName="Set Build Location" sap:VirtualizedContainerService.HintSize="242,60">
            <Assign.To>
              <OutArgument x:TypeArguments="x:Uri">[VMWareLabWorkflowParameters.BuildDetails.BuildUri]</OutArgument>
            </Assign.To>
            <Assign.Value>
              <InArgument x:TypeArguments="x:Uri">[ChildBuildDetail.Uri]</InArgument>
            </Assign.Value>
          </Assign>
        </Sequence>
      </If.Then>
    </If>
    <ForEach x:TypeArguments="v:EnvironmentParameter" DisplayName="ForEach&lt;EnvironmentParameter&gt;" sap:VirtualizedContainerService.HintSize="1541,316" Values="[VMWareLabWorkflowParameters.EnvironmentDetails.EnvironmentParameters]">
      <ActivityAction x:TypeArguments="v:EnvironmentParameter">
        <ActivityAction.Argument>
          <DelegateInArgument x:TypeArguments="v:EnvironmentParameter" Name="envParameter" />
        </ActivityAction.Argument>
        <If Condition="[String.IsNullOrEmpty(EnvironmentsSummary)]" sap:VirtualizedContainerService.HintSize="509,208">
          <If.Then>
            <Assign sap:VirtualizedContainerService.HintSize="242,60">
              <Assign.To>
                <OutArgument x:TypeArguments="x:String">[EnvironmentsSummary]</OutArgument>
              </Assign.To>
              <Assign.Value>
                <InArgument x:TypeArguments="x:String">[envParameter.VirtualMachineName]</InArgument>
              </Assign.Value>
            </Assign>
          </If.Then>
          <If.Else>
            <Assign sap:VirtualizedContainerService.HintSize="242,60">
              <Assign.To>
                <OutArgument x:TypeArguments="x:String">[EnvironmentsSummary]</OutArgument>
              </Assign.To>
              <Assign.Value>
                <InArgument x:TypeArguments="x:String">[EnvironmentsSummary + ", " + envParameter.VirtualMachineName]</InArgument>
              </Assign.Value>
            </Assign>
          </If.Else>
        </If>
      </ActivityAction>
    </ForEach>
    <mtlwa:WriteDeploymentInformation Url="{x:Null}" DeploymentInformationType="[Microsoft.TeamFoundation.Build.Common.DeploymentInformationTypes.Deploy]" DisplayName="Update Deployment Summary" sap:VirtualizedContainerService.HintSize="1541,22" Message="[String.Format(&quot;Lab environment: {0}&quot;, EnvironmentsSummary)]" />
    <mtlwa:GetBuildLocationAndBuildNumber BuildDetails="[VMWareLabWorkflowParameters.BuildDetails]" BuildNumber="[BuildNumber]" DisplayName="Get Build Location And Build Number" sap:VirtualizedContainerService.HintSize="1541,22" Result="[BuildLocation]" SelectedBuild="[SelectedBuildDetail]" />
    <mtbwa:WriteBuildMessage sap:VirtualizedContainerService.HintSize="1541,22" Importance="[Microsoft.TeamFoundation.Build.Client.BuildMessageImportance.High]" Message="Get Build Location and Number succeeded!" mva:VisualBasic.Settings="Assembly references and imported namespaces serialized as XML namespaces" />
    <If Condition="[VMWareLabWorkflowParameters.BuildDetails.IsTeamSystemBuild = True]" DisplayName="Compute build location needed" sap:VirtualizedContainerService.HintSize="1541,208">
      <sap:WorkflowViewStateService.ViewState>
        <scg:Dictionary x:TypeArguments="x:String, x:Object">
          <x:Boolean x:Key="IsExpanded">False</x:Boolean>
          <x:Boolean x:Key="IsPinned">False</x:Boolean>
        </scg:Dictionary>
      </sap:WorkflowViewStateService.ViewState>
      <If.Then>
        <Assign DisplayName="Compute build path" sap:VirtualizedContainerService.HintSize="242,60">
          <Assign.To>
            <OutArgument x:TypeArguments="x:String">[BuildLocation]</OutArgument>
          </Assign.To>
          <Assign.Value>
            <InArgument x:TypeArguments="x:String">[If(VMWareLabWorkflowParameters.BuildDetails.Configuration Is Nothing, BuildLocation, If(VMWareLabWorkflowParameters.BuildDetails.Configuration.IsEmpty Or (SelectedBuildDetail.Information.GetNodesByType(Microsoft.TeamFoundation.Build.Common.InformationTypes.ConfigurationSummary, True)).Count = 1, BuildLocation, If(VMWareLabWorkflowParameters.BuildDetails.Configuration.IsPlatformEmptyOrAnyCpu, BuildLocation + "\" + VMWareLabWorkflowParameters.BuildDetails.Configuration.Configuration, BuildLocation + "\" + VMWareLabWorkflowParameters.BuildDetails.Configuration.Platform + "\" + VMWareLabWorkflowParameters.BuildDetails.Configuration.Configuration)))]</InArgument>
          </Assign.Value>
        </Assign>
      </If.Then>
    </If>
    <If Condition="[VMWareLabWorkflowParameters.EnvironmentDetails.RevertToSnapshot = True]" DisplayName="If revert to snapshot is needed" sap:VirtualizedContainerService.HintSize="1541,918">
      <sap:WorkflowViewStateService.ViewState>
        <scg:Dictionary x:TypeArguments="x:String, x:Object">
          <x:Boolean x:Key="IsExpanded">True</x:Boolean>
          <x:Boolean x:Key="IsPinned">False</x:Boolean>
        </scg:Dictionary>
      </sap:WorkflowViewStateService.ViewState>
      <If.Then>
        <Sequence DisplayName="Get virtual machines for restore" sap:VirtualizedContainerService.HintSize="538,810">
          <Sequence.Variables>
            <Variable x:TypeArguments="vv:VimClient" Name="vMWareConnection" />
            <Variable x:TypeArguments="vv:VirtualMachine" Name="FoundVirtualMachine" />
          </Sequence.Variables>
          <sap:WorkflowViewStateService.ViewState>
            <scg:Dictionary x:TypeArguments="x:String, x:Object">
              <x:Boolean x:Key="IsExpanded">True</x:Boolean>
              <x:Boolean x:Key="IsPinned">False</x:Boolean>
            </scg:Dictionary>
          </sap:WorkflowViewStateService.ViewState>
          <v1:ConnectToVMWareServerActivity sap:VirtualizedContainerService.HintSize="516,22" Password="[VMWareLabWorkflowParameters.EnvironmentDetails.Password]" ServerCommunicationProtocol="[Nothing]" ServerName="[VMWareLabWorkflowParameters.EnvironmentDetails.ServerName]" ServerPort="[VMWareLabWorkflowParameters.EnvironmentDetails.ServerPort]" UserName="[VMWareLabWorkflowParameters.EnvironmentDetails.UserName]" VMWareConnection="[vMWareConnection]" />
          <ForEach x:TypeArguments="v:EnvironmentParameter" DisplayName="ForEach&lt;EnvironmentParameter&gt;" sap:VirtualizedContainerService.HintSize="516,624" Values="[VMWareLabWorkflowParameters.EnvironmentDetails.EnvironmentParameters]">
            <ActivityAction x:TypeArguments="v:EnvironmentParameter">
              <ActivityAction.Argument>
                <DelegateInArgument x:TypeArguments="v:EnvironmentParameter" Name="envParameter" />
              </ActivityAction.Argument>
              <Sequence DisplayName="RestoreSnapshot" sap:VirtualizedContainerService.HintSize="486,516">
                <Sequence.Variables>
                  <Variable x:TypeArguments="vv:VirtualMachinePowerState" Name="vmPowerState" />
                </Sequence.Variables>
                <sap:WorkflowViewStateService.ViewState>
                  <scg:Dictionary x:TypeArguments="x:String, x:Object">
                    <x:Boolean x:Key="IsExpanded">True</x:Boolean>
                  </scg:Dictionary>
                </sap:WorkflowViewStateService.ViewState>
                <v1:GetVMsActivity EnvironmentName="[envParameter.VirtualMachineName]" FoundVM="[FoundVirtualMachine]" sap:VirtualizedContainerService.HintSize="464,22" VMWareConnection="[vMWareConnection]" />
                <v1:RestoreSnapshotAcitvity sap:VirtualizedContainerService.HintSize="464,22" SnapshotPath="[envParameter.SnapshotName]" VirtualMachine="[FoundVirtualMachine]" />
                <v1:GetVMPowerStateActivity sap:VirtualizedContainerService.HintSize="464,22" VirtualMachine="[FoundVirtualMachine]" VirtualMachinePowerState="[vmPowerState]" />
                <If Condition="[vmPowerState &lt;&gt; VirtualMachinePowerState.poweredOn]" sap:VirtualizedContainerService.HintSize="464,206">
                  <If.Then>
                    <v1:PowerOnVMAcitvity sap:VirtualizedContainerService.HintSize="269,100" VirtualMachine="[FoundVirtualMachine]" />
                  </If.Then>
                </If>
              </Sequence>
            </ActivityAction>
          </ForEach>
        </Sequence>
      </If.Then>
    </If>
    <If Condition="[VMWareLabWorkflowParameters.DeploymentDetails.DeploymentNeeded = True]" DisplayName="If Deployment is needed" sap:VirtualizedContainerService.HintSize="1541,1630">
      <sap:WorkflowViewStateService.ViewState>
        <scg:Dictionary x:TypeArguments="x:String, x:Object">
          <x:Boolean x:Key="IsExpanded">True</x:Boolean>
          <x:Boolean x:Key="IsPinned">False</x:Boolean>
        </scg:Dictionary>
      </sap:WorkflowViewStateService.ViewState>
      <If.Then>
        <Sequence DisplayName="Do deployment" sap:VirtualizedContainerService.HintSize="538,1524">
          <sap:WorkflowViewStateService.ViewState>
            <scg:Dictionary x:TypeArguments="x:String, x:Object">
              <x:Boolean x:Key="IsExpanded">True</x:Boolean>
              <x:Boolean x:Key="IsPinned">False</x:Boolean>
            </scg:Dictionary>
          </sap:WorkflowViewStateService.ViewState>
          <ForEach x:TypeArguments="x:String" DisplayName="Run Deployment scripts" sap:VirtualizedContainerService.HintSize="516,1338" Values="[VMWareLabWorkflowParameters.DeploymentDetails.Scripts]">
            <sap:WorkflowViewStateService.ViewState>
              <scg:Dictionary x:TypeArguments="x:String, x:Object">
                <x:Boolean x:Key="IsPinned">False</x:Boolean>
              </scg:Dictionary>
            </sap:WorkflowViewStateService.ViewState>
            <ActivityAction x:TypeArguments="x:String">
              <ActivityAction.Argument>
                <DelegateInArgument x:TypeArguments="x:String" Name="deploymentScript" />
              </ActivityAction.Argument>
              <Sequence DisplayName="Run Script On Machine" sap:VirtualizedContainerService.HintSize="486,1232">
                <Sequence.Variables>
                  <Variable x:TypeArguments="x:String" Name="ScriptFile" />
                  <Variable x:TypeArguments="mtbwa:AgentReservationSpec" Default="[New AgentReservationSpec()]" Name="ReservationSpec" />
                  <Variable x:TypeArguments="x:String" Name="ScriptArguments" />
                  <Variable x:TypeArguments="s:String[]" Name="SplitScript" />
                  <Variable x:TypeArguments="x:Int32" Default="0" Name="ScriptResult" />
                </Sequence.Variables>
                <sap:WorkflowViewStateService.ViewState>
                  <scg:Dictionary x:TypeArguments="x:String, x:Object">
                    <x:Boolean x:Key="IsExpanded">True</x:Boolean>
                    <x:Boolean x:Key="IsPinned">False</x:Boolean>
                  </scg:Dictionary>
                </sap:WorkflowViewStateService.ViewState>
                <Assign sap:VirtualizedContainerService.HintSize="464,58">
                  <Assign.To>
                    <OutArgument x:TypeArguments="s:String[]">[SplitScript]</OutArgument>
                  </Assign.To>
                  <Assign.Value>
                    <InArgument x:TypeArguments="s:String[]">[deploymentScript.Split(New [Char]() {"#"c})]</InArgument>
                  </Assign.Value>
                </Assign>
                <Assign sap:VirtualizedContainerService.HintSize="464,58">
                  <Assign.To>
                    <OutArgument x:TypeArguments="x:String">[ScriptFile]</OutArgument>
                  </Assign.To>
                  <Assign.Value>
                    <InArgument x:TypeArguments="x:String">[SplitScript(1).Trim().Replace("$(BuildLocation)", BuildLocation)]</InArgument>
                  </Assign.Value>
                </Assign>
                <If Condition="[SplitScript.Length &gt; 2]" DisplayName="If script has arguments" sap:VirtualizedContainerService.HintSize="464,206">
                  <If.Then>
                    <Assign sap:VirtualizedContainerService.HintSize="291,100">
                      <Assign.To>
                        <OutArgument x:TypeArguments="x:String">[ScriptArguments]</OutArgument>
                      </Assign.To>
                      <Assign.Value>
                        <InArgument x:TypeArguments="x:String">[SplitScript(2).Trim().Replace("$(BuildLocation)", BuildLocation)]</InArgument>
                      </Assign.Value>
                    </Assign>
                  </If.Then>
                </If>
                <Assign sap:VirtualizedContainerService.HintSize="464,58">
                  <Assign.To>
                    <OutArgument x:TypeArguments="x:String">[ReservationSpec.Name]</OutArgument>
                  </Assign.To>
                  <Assign.Value>
                    <InArgument x:TypeArguments="x:String">[SplitScript(0).Trim()]</InArgument>
                  </Assign.Value>
                </Assign>
                <mtbwa:AgentScope DataToIgnore="" DisplayName="Agent Scope" sap:VirtualizedContainerService.HintSize="464,322" MaxExecutionTime="[New TimeSpan(0,0,0)]" MaxWaitTime="[New TimeSpan(0, 5, 0)]" ReservationSpec="[ReservationSpec]" mva:VisualBasic.Settings="Assembly references and imported namespaces serialized as XML namespaces">
                  <mtbwa:InvokeProcess Arguments="[ScriptArguments]" DisplayName="Invoke Script" FileName="[ScriptFile]" sap:VirtualizedContainerService.HintSize="234,198" Result="[ScriptResult]">
                    <mtbwa:InvokeProcess.ErrorDataReceived>
                      <ActivityAction x:TypeArguments="x:String">
                        <ActivityAction.Argument>
                          <DelegateInArgument x:TypeArguments="x:String" Name="errOutput" />
                        </ActivityAction.Argument>
                        <mtbwa:WriteBuildMessage DisplayName="Write Script Error" sap:VirtualizedContainerService.HintSize="200,22" Importance="[Microsoft.TeamFoundation.Build.Client.BuildMessageImportance.High]" Message="[errOutput]" mva:VisualBasic.Settings="Assembly references and imported namespaces serialized as XML namespaces" />
                      </ActivityAction>
                    </mtbwa:InvokeProcess.ErrorDataReceived>
                    <mtbwa:InvokeProcess.OutputDataReceived>
                      <ActivityAction x:TypeArguments="x:String">
                        <ActivityAction.Argument>
                          <DelegateInArgument x:TypeArguments="x:String" Name="stdOutput" />
                        </ActivityAction.Argument>
                        <mtbwa:WriteBuildMessage DisplayName="Write Script Output" sap:VirtualizedContainerService.HintSize="200,22" Importance="[Microsoft.TeamFoundation.Build.Client.BuildMessageImportance.High]" Message="[stdOutput]" mva:VisualBasic.Settings="Assembly references and imported namespaces serialized as XML namespaces" />
                      </ActivityAction>
                    </mtbwa:InvokeProcess.OutputDataReceived>
                  </mtbwa:InvokeProcess>
                </mtbwa:AgentScope>
                <If Condition="[ScriptResult &lt;&gt; 0]" sap:VirtualizedContainerService.HintSize="464,206">
                  <If.Then>
                    <TerminateWorkflow sap:VirtualizedContainerService.HintSize="269,100" Reason="Script execution has failed." />
                  </If.Then>
                </If>
              </Sequence>
            </ActivityAction>
          </ForEach>
          <mtlwa:WriteDeploymentInformation DeploymentInformationType="[Microsoft.TeamFoundation.Build.Common.DeploymentInformationTypes.Deploy]" DisplayName="Application Deployment Succeeded" sap:VirtualizedContainerService.HintSize="516,22" Message="[String.Format(&quot;The application was deployed successfully from the following build location:&quot;)]" Url="[BuildLocation]" />
        </Sequence>
      </If.Then>
    </If>
    <If Condition="[VMWareLabWorkflowParameters.DeploymentDetails.TakePostDeploymentSnapshot = True]" DisplayName="If snapshot is needed" sap:VirtualizedContainerService.HintSize="1541,1060">
      <sap:WorkflowViewStateService.ViewState>
        <scg:Dictionary x:TypeArguments="x:String, x:Object">
          <x:Boolean x:Key="IsExpanded">True</x:Boolean>
          <x:Boolean x:Key="IsPinned">False</x:Boolean>
        </scg:Dictionary>
      </sap:WorkflowViewStateService.ViewState>
      <If.Then>
        <Sequence DisplayName="Get virtual machines for snapshot" sap:VirtualizedContainerService.HintSize="538,912">
          <Sequence.Variables>
            <Variable x:TypeArguments="vv:VimClient" Name="vMWareConnection" />
            <Variable x:TypeArguments="x:String" Name="variable1" />
            <Variable x:TypeArguments="vv:VirtualMachine" Name="FoundVirtualMachine" />
            <Variable x:TypeArguments="x:String" Name="BuildSnapshotName" />
          </Sequence.Variables>
          <sap:WorkflowViewStateService.ViewState>
            <scg:Dictionary x:TypeArguments="x:String, x:Object">
              <x:Boolean x:Key="IsExpanded">True</x:Boolean>
              <x:Boolean x:Key="IsPinned">False</x:Boolean>
            </scg:Dictionary>
          </sap:WorkflowViewStateService.ViewState>
          <Assign sap:VirtualizedContainerService.HintSize="516,60">
            <Assign.To>
              <OutArgument x:TypeArguments="x:String">[BuildSnapshotName]</OutArgument>
            </Assign.To>
            <Assign.Value>
              <InArgument x:TypeArguments="x:String">[VMWareLabWorkflowParameters.DeploymentDetails.PostDeploymentSnapshotName + "_" + BuildDetail.BuildNumber]</InArgument>
            </Assign.Value>
          </Assign>
          <v1:ConnectToVMWareServerActivity sap:VirtualizedContainerService.HintSize="516,22" Password="[VMWareLabWorkflowParameters.EnvironmentDetails.Password]" ServerCommunicationProtocol="[Nothing]" ServerName="[VMWareLabWorkflowParameters.EnvironmentDetails.ServerName]" ServerPort="[VMWareLabWorkflowParameters.EnvironmentDetails.ServerPort]" UserName="[VMWareLabWorkflowParameters.EnvironmentDetails.UserName]" VMWareConnection="[vMWareConnection]" />
          <ForEach x:TypeArguments="v:EnvironmentParameter" DisplayName="ForEach&lt;EnvironmentParameter&gt;" sap:VirtualizedContainerService.HintSize="516,626" Values="[VMWareLabWorkflowParameters.EnvironmentDetails.EnvironmentParameters]">
            <ActivityAction x:TypeArguments="v:EnvironmentParameter">
              <ActivityAction.Argument>
                <DelegateInArgument x:TypeArguments="v:EnvironmentParameter" Name="envParameter" />
              </ActivityAction.Argument>
              <Sequence DisplayName="RestoreSnapshot" sap:VirtualizedContainerService.HintSize="486,518">
                <Sequence.Variables>
                  <Variable x:TypeArguments="vv:VirtualMachinePowerState" Name="vmPowerState" />
                </Sequence.Variables>
                <sap:WorkflowViewStateService.ViewState>
                  <scg:Dictionary x:TypeArguments="x:String, x:Object">
                    <x:Boolean x:Key="IsExpanded">True</x:Boolean>
                  </scg:Dictionary>
                </sap:WorkflowViewStateService.ViewState>
                <v1:GetVMsActivity EnvironmentName="[envParameter.VirtualMachineName]" FoundVM="[FoundVirtualMachine]" sap:VirtualizedContainerService.HintSize="464,22" VMWareConnection="[vMWareConnection]" />
                <v1:TakeSnapshotAcitvity sap:VirtualizedContainerService.HintSize="464,22" Memory="True" Quiesce="False" SnapshotDescription="[&quot;Snapshot from build: &quot; + BuildNumber]" SnapshotName="[BuildSnapshotName]" VirtualMachine="[FoundVirtualMachine]" />
                <v1:GetVMPowerStateActivity sap:VirtualizedContainerService.HintSize="464,22" VirtualMachine="[FoundVirtualMachine]" VirtualMachinePowerState="[vmPowerState]" />
                <If Condition="[vmPowerState &lt;&gt; VirtualMachinePowerState.poweredOn]" sap:VirtualizedContainerService.HintSize="464,208">
                  <If.Then>
                    <v1:PowerOnVMAcitvity sap:VirtualizedContainerService.HintSize="269,100" VirtualMachine="[FoundVirtualMachine]" />
                  </If.Then>
                </If>
              </Sequence>
            </ActivityAction>
          </ForEach>
        </Sequence>
      </If.Then>
    </If>
    <If Condition="[VMWareLabWorkflowParameters.TestParameters.RunTest]" DisplayName="If Testing is needed" sap:VirtualizedContainerService.HintSize="1541,752">
      <sap:WorkflowViewStateService.ViewState>
        <scg:Dictionary x:TypeArguments="x:String, x:Object">
          <x:Boolean x:Key="IsExpanded">False</x:Boolean>
          <x:Boolean x:Key="IsPinned">False</x:Boolean>
        </scg:Dictionary>
      </sap:WorkflowViewStateService.ViewState>
      <If.Then>
        <Sequence DisplayName="Run Tests" sap:VirtualizedContainerService.HintSize="656,604">
          <Sequence.Variables>
            <Variable x:TypeArguments="mtltc:TestingCapabilityInformation" Name="TestCapabilityInfo" />
            <Variable x:TypeArguments="x:String" Name="variable1" />
            <Variable x:TypeArguments="mtlwa:TestRunStatistics" Default="[New Microsoft.TeamFoundation.Lab.Workflow.Activities.TestRunStatistics()]" Name="TestResults" />
          </Sequence.Variables>
          <sap:WorkflowViewStateService.ViewState>
            <scg:Dictionary x:TypeArguments="x:String, x:Object">
              <x:Boolean x:Key="IsExpanded">True</x:Boolean>
              <x:Boolean x:Key="IsPinned">False</x:Boolean>
            </scg:Dictionary>
          </sap:WorkflowViewStateService.ViewState>
          <mtbwa:WriteBuildMessage sap:VirtualizedContainerService.HintSize="634,22" Importance="[Microsoft.TeamFoundation.Build.Client.BuildMessageImportance.High]" Message="[String.Format(&quot;Running test for: ProjectName: {0}, TestConfigurationId: {1}, TestPlanId: {2}, TestSettingsId: {3}, TfsUrl: {4}&quot;,&#xA;              VMWareLabWorkflowParameters.TestParameters.ProjectName,&#xA;              VMWareLabWorkflowParameters.TestParameters.TestConfigurationId,&#xA;              VMWareLabWorkflowParameters.TestParameters.TestPlanId,&#xA;              VMWareLabWorkflowParameters.TestParameters.TestSettingsId,&#xA;              VMWareLabWorkflowParameters.TestParameters.TfsUrl)]" mva:VisualBasic.Settings="Assembly references and imported namespaces serialized as XML namespaces" />
          <mtlwa:ExecuteRemoteTestRun MaxWaitTime="{x:Null}" BuildNumber="[BuildNumber]" DisplayName="Running Tests" sap:VirtualizedContainerService.HintSize="634,22" MaxConsecutiveFailuresToIgnoreDuringWaitForCompletion="[3]" RefreshInterval="[System.TimeSpan.FromMinutes(1)]" Result="[TestResults]" TestDirectory="[BuildLocation]" TestEnvironment="[VMWareLabWorkflowParameters.EnvironmentDetails.TestEnvironmentName]" TestParameters="[VMWareLabWorkflowParameters.TestParameters]" Title="[String.Format(&quot;{0}&quot;, BuildDetail.BuildNumber)]">
            <mtlwa:ExecuteRemoteTestRun.LabEnvironmentUri>
              <InArgument x:TypeArguments="x:String">
                <Literal x:TypeArguments="x:String" Value="" />
              </InArgument>
            </mtlwa:ExecuteRemoteTestRun.LabEnvironmentUri>
          </mtlwa:ExecuteRemoteTestRun>
          <If Condition="[TestResults.PassedTests &lt;&gt; TestResults.TotalTests]" DisplayName="If all tests have not passed" sap:VirtualizedContainerService.HintSize="634,356">
            <If.Then>
              <If Condition="[TestResults.PassedTests &gt; 0]" DisplayName="Set build status" sap:VirtualizedContainerService.HintSize="509,208">
                <If.Then>
                  <Assign DisplayName="Partailly succeded" sap:VirtualizedContainerService.HintSize="242,60">
                    <Assign.To>
                      <OutArgument x:TypeArguments="mtbc:BuildStatus">[BuildStatus]</OutArgument>
                    </Assign.To>
                    <Assign.Value>
                      <InArgument x:TypeArguments="mtbc:BuildStatus">[Microsoft.TeamFoundation.Build.Client.BuildStatus.PartiallySucceeded]</InArgument>
                    </Assign.Value>
                  </Assign>
                </If.Then>
                <If.Else>
                  <Assign DisplayName="Failed" sap:VirtualizedContainerService.HintSize="242,60">
                    <Assign.To>
                      <OutArgument x:TypeArguments="mtbc:BuildStatus">[BuildStatus]</OutArgument>
                    </Assign.To>
                    <Assign.Value>
                      <InArgument x:TypeArguments="mtbc:BuildStatus">[Microsoft.TeamFoundation.Build.Client.BuildStatus.Failed]</InArgument>
                    </Assign.Value>
                  </Assign>
                </If.Else>
              </If>
            </If.Then>
          </If>
        </Sequence>
      </If.Then>
    </If>
    <If Condition="[VMWareLabWorkflowParameters.AutomatedTestSettings.RunAutomatedTests]" DisplayName="If MSTest is needed" sap:VirtualizedContainerService.HintSize="1541,5890">
      <sap:WorkflowViewStateService.ViewState>
        <scg:Dictionary x:TypeArguments="x:String, x:Object">
          <x:Boolean x:Key="IsPinned">False</x:Boolean>
        </scg:Dictionary>
      </sap:WorkflowViewStateService.ViewState>
      <If.Then>
        <Sequence DisplayName="MSTest Sequence" sap:VirtualizedContainerService.HintSize="1416,5784">
          <Sequence.Variables>
            <Variable x:TypeArguments="mtbwa:AgentReservationSpec" Default="[New AgentReservationSpec()]" Name="TestReservationSpec" />
          </Sequence.Variables>
          <sap:WorkflowViewStateService.ViewState>
            <scg:Dictionary x:TypeArguments="x:String, x:Object">
              <x:Boolean x:Key="IsExpanded">True</x:Boolean>
              <x:Boolean x:Key="IsPinned">False</x:Boolean>
            </scg:Dictionary>
          </sap:WorkflowViewStateService.ViewState>
          <mtbwa:AgentScope DataToIgnore="" DisplayName="Run On Agent" sap:VirtualizedContainerService.HintSize="1394,5660" MaxExecutionTime="[AgentSettings.MaxExecutionTime]" MaxWaitTime="[AgentSettings.MaxWaitTime]" ReservationSpec="[AgentSettings.GetAgentReservationSpec()]" mva:VisualBasic.Settings="Assembly references and imported namespaces serialized as XML namespaces">
            <mtbwa:AgentScope.Variables>
              <Variable x:TypeArguments="mtbc:IBuildAgent" Name="BuildAgent" />
              <Variable x:TypeArguments="mtvc:Workspace" Name="Workspace" />
              <Variable x:TypeArguments="x:String" Name="BuildDirectory" />
              <Variable x:TypeArguments="x:String" Default="[BuildDetail.BuildNumber]" Name="LabelName" />
              <Variable x:TypeArguments="x:String" Name="WorkspaceName" />
              <Variable x:TypeArguments="x:String" Name="SourcesDirectory" />
              <Variable x:TypeArguments="x:String" Name="BinariesDirectory" />
              <Variable x:TypeArguments="x:String" Name="TestResultsDirectory" />
            </mtbwa:AgentScope.Variables>
            <sap:WorkflowViewStateService.ViewState>
              <scg:Dictionary x:TypeArguments="x:String, x:Object">
                <x:Boolean x:Key="IsExpanded">True</x:Boolean>
                <x:Boolean x:Key="IsPinned">False</x:Boolean>
              </scg:Dictionary>
            </sap:WorkflowViewStateService.ViewState>
            <Sequence DisplayName="Initialize Variables" sap:VirtualizedContainerService.HintSize="1372,456" mtbwt:BuildTrackingParticipant.Importance="Low">
              <sap:WorkflowViewStateService.ViewState>
                <scg:Dictionary x:TypeArguments="x:String, x:Object">
                  <x:Boolean x:Key="IsExpanded">True</x:Boolean>
                  <x:Boolean x:Key="IsPinned">False</x:Boolean>
                </scg:Dictionary>
              </sap:WorkflowViewStateService.ViewState>
              <mtbwa:GetBuildAgent DisplayName="Get the Agent" sap:VirtualizedContainerService.HintSize="200,22" mtbwt:BuildTrackingParticipant.Importance="Low" Result="[BuildAgent]" />
              <mtbwa:GetBuildDirectory DisplayName="Get the Build Directory" sap:VirtualizedContainerService.HintSize="200,22" mtbwt:BuildTrackingParticipant.Importance="Low" Result="[BuildDirectory]" />
              <Assign x:TypeArguments="x:String" DisplayName="Initialize Workspace Name" sap:VirtualizedContainerService.HintSize="200,22" mtbwt:BuildTrackingParticipant.Importance="Low" To="[WorkspaceName]" Value="[String.Format(&quot;{0}_{1}_{2}&quot;, BuildDetail.BuildDefinition.Id, Microsoft.TeamFoundation.LinkingUtilities.DecodeUri(BuildAgent.Uri.AbsoluteUri).ToolSpecificId, BuildAgent.ServiceHost.Name)]" />
              <Assign x:TypeArguments="x:String" DisplayName="Initialize Sources Directory" sap:VirtualizedContainerService.HintSize="200,22" mtbwt:BuildTrackingParticipant.Importance="Low" To="[SourcesDirectory]" Value="[String.Format(&quot;{0}\Sources&quot;, BuildDirectory)]" />
              <Assign x:TypeArguments="x:String" DisplayName="Initialize Binaries Directory" sap:VirtualizedContainerService.HintSize="200,22" mtbwt:BuildTrackingParticipant.Importance="Low" To="[BinariesDirectory]" Value="[String.Format(&quot;{0}\Binaries&quot;, BuildDirectory)]" />
              <Assign x:TypeArguments="x:String" DisplayName="Initialize TestResults Directory" sap:VirtualizedContainerService.HintSize="200,22" mtbwt:BuildTrackingParticipant.Importance="Low" To="[TestResultsDirectory]" Value="[String.Format(&quot;{0}\TestResults&quot;, BuildDirectory)]" />
            </Sequence>
            <Sequence DisplayName="Initialize Workspace" sap:VirtualizedContainerService.HintSize="1372,870" mtbwt:BuildTrackingParticipant.Importance="Low">
              <sap:WorkflowViewStateService.ViewState>
                <scg:Dictionary x:TypeArguments="x:String, x:Object">
                  <x:Boolean x:Key="IsExpanded">True</x:Boolean>
                  <x:Boolean x:Key="IsPinned">False</x:Boolean>
                </scg:Dictionary>
              </sap:WorkflowViewStateService.ViewState>
              <mtbwa:DeleteDirectory Directory="[TestResultsDirectory]" DisplayName="Delete Test Results Directory" sap:VirtualizedContainerService.HintSize="464,22" mtbwt:BuildTrackingParticipant.Importance="Normal" Recursive="[True]" />
              <If Condition="[Not CleanWorkspace = Microsoft.TeamFoundation.Build.Workflow.Activities.CleanWorkspaceOption.None]" DisplayName="If Not CleanWorkspace = CleanWorkspaceOption.None" sap:VirtualizedContainerService.HintSize="464,206" mtbwt:BuildTrackingParticipant.Importance="Low">
                <If.Then>
                  <mtbwa:DeleteDirectory Directory="[BinariesDirectory]" DisplayName="Delete Binaries Directory" sap:VirtualizedContainerService.HintSize="269,100" mtbwt:BuildTrackingParticipant.Importance="Normal" />
                </If.Then>
              </If>
              <If Condition="[CleanWorkspace = Microsoft.TeamFoundation.Build.Workflow.Activities.CleanWorkspaceOption.All]" DisplayName="If CleanWorkspace = CleanWorkspaceOption.All" sap:VirtualizedContainerService.HintSize="464,314" mtbwt:BuildTrackingParticipant.Importance="Low">
                <If.Then>
                  <Sequence DisplayName="Delete Workspace and Sources Directory" sap:VirtualizedContainerService.HintSize="281,208" mtbwt:BuildTrackingParticipant.Importance="Low">
                    <sap:WorkflowViewStateService.ViewState>
                      <scg:Dictionary x:TypeArguments="x:String, x:Object">
                        <x:Boolean x:Key="IsExpanded">True</x:Boolean>
                      </scg:Dictionary>
                    </sap:WorkflowViewStateService.ViewState>
                    <mtbwa:DeleteWorkspace DeleteLocalItems="[True]" DisplayName="Delete Workspace" sap:VirtualizedContainerService.HintSize="200,22" mtbwt:BuildTrackingParticipant.Importance="Normal" Name="[WorkspaceName]" />
                    <mtbwa:DeleteDirectory Directory="[SourcesDirectory]" DisplayName="Delete Sources Directory" sap:VirtualizedContainerService.HintSize="200,22" mtbwt:BuildTrackingParticipant.Importance="Normal" />
                  </Sequence>
                </If.Then>
              </If>
              <mtbwa:CreateWorkspace BuildDirectory="[BuildDirectory]" Comment="[&quot;Workspace Created by Team Build&quot;]" DisplayName="Create Workspace" sap:VirtualizedContainerService.HintSize="464,22" Name="[WorkspaceName]" Result="[Workspace]" SourcesDirectory="[SourcesDirectory]" />
              <mtbwa:SyncWorkspace DisplayName="Get Workspace" sap:VirtualizedContainerService.HintSize="464,22" mva:VisualBasic.Settings="Assembly references and imported namespaces serialized as XML namespaces" VersionOverride="[VMWareLabWorkflowParameters.AutomatedTestSettings.GetVersion]" Workspace="[Workspace]" />
            </Sequence>
            <TryCatch DisplayName="Try Compile, Test, and Associate Changesets and Work Items" sap:VirtualizedContainerService.HintSize="1372,4130" mtbwt:BuildTrackingParticipant.Importance="Low">
              <sap:WorkflowViewStateService.ViewState>
                <scg:Dictionary x:TypeArguments="x:String, x:Object">
                  <x:Boolean x:Key="IsExpanded">True</x:Boolean>
                  <x:Boolean x:Key="IsPinned">False</x:Boolean>
                </scg:Dictionary>
              </sap:WorkflowViewStateService.ViewState>
              <TryCatch.Finally>
                <Sequence DisplayName="Revert Workspace and Copy Files to Drop Location" sap:VirtualizedContainerService.HintSize="1354,270" mtbwt:BuildTrackingParticipant.Importance="Low">
                  <sap:WorkflowViewStateService.ViewState>
                    <scg:Dictionary x:TypeArguments="x:String, x:Object">
                      <x:Boolean x:Key="IsExpanded">True</x:Boolean>
                      <x:Boolean x:Key="IsPinned">False</x:Boolean>
                    </scg:Dictionary>
                  </sap:WorkflowViewStateService.ViewState>
                  <mtbwa:InvokeForReason DisplayName="Revert Workspace for Shelveset Builds" sap:VirtualizedContainerService.HintSize="222,146" Reason="ValidateShelveset, CheckInShelveset">
                    <sap:WorkflowViewStateService.ViewState>
                      <scg:Dictionary x:TypeArguments="x:String, x:Object">
                        <x:Boolean x:Key="IsPinned">False</x:Boolean>
                      </scg:Dictionary>
                    </sap:WorkflowViewStateService.ViewState>
                    <mtbwa:RevertWorkspace DisplayName="Revert Workspace" sap:VirtualizedContainerService.HintSize="200,22" Workspace="[Workspace]" />
                  </mtbwa:InvokeForReason>
                </Sequence>
              </TryCatch.Finally>
              <TryCatch.Try>
                <Sequence sap:VirtualizedContainerService.HintSize="1354,3691" mtbwt:BuildTrackingParticipant.Importance="None">
                  <Sequence.Variables>
                    <Variable x:TypeArguments="s:Exception" Name="compilationException" />
                    <Variable x:TypeArguments="scg:IList(mtvc:Changeset)" Name="associatedChangesets" />
                    <Variable x:TypeArguments="x:Boolean" Name="treatTestFailureAsBuildFailure" />
                  </Sequence.Variables>
                  <sap:WorkflowViewStateService.ViewState>
                    <scg:Dictionary x:TypeArguments="x:String, x:Object">
                      <x:Boolean x:Key="IsExpanded">True</x:Boolean>
                      <x:Boolean x:Key="IsPinned">False</x:Boolean>
                    </scg:Dictionary>
                  </sap:WorkflowViewStateService.ViewState>
                  <Parallel DisplayName="Compile, Test, and Associate Changesets and Work Items" sap:VirtualizedContainerService.HintSize="1332,3321">
                    <sap:WorkflowViewStateService.ViewState>
                      <scg:Dictionary x:TypeArguments="x:String, x:Object">
                        <x:Boolean x:Key="IsPinned">False</x:Boolean>
                      </scg:Dictionary>
                    </sap:WorkflowViewStateService.ViewState>
                    <TryCatch DisplayName="Try Compile and Test" sap:VirtualizedContainerService.HintSize="1218,3275" mtbwt:BuildTrackingParticipant.Importance="Low">
                      <sap:WorkflowViewStateService.ViewState>
                        <scg:Dictionary x:TypeArguments="x:String, x:Object">
                          <x:Boolean x:Key="IsPinned">False</x:Boolean>
                        </scg:Dictionary>
                      </sap:WorkflowViewStateService.ViewState>
                      <TryCatch.Try>
                        <Sequence DisplayName="Compile and Test" sap:VirtualizedContainerService.HintSize="1200,2897">
                          <sap:WorkflowViewStateService.ViewState>
                            <scg:Dictionary x:TypeArguments="x:String, x:Object">
                              <x:Boolean x:Key="IsExpanded">True</x:Boolean>
                              <x:Boolean x:Key="IsPinned">False</x:Boolean>
                            </scg:Dictionary>
                          </sap:WorkflowViewStateService.ViewState>
                          <If Condition="True" DisplayName="If Not DisableTests" sap:VirtualizedContainerService.HintSize="1178,2281" mtbwt:BuildTrackingParticipant.Importance="Low">
                            <sap:WorkflowViewStateService.ViewState>
                              <scg:Dictionary x:TypeArguments="x:String, x:Object">
                                <x:Boolean x:Key="IsPinned">False</x:Boolean>
                              </scg:Dictionary>
                            </sap:WorkflowViewStateService.ViewState>
                            <If.Then>
                              <Sequence DisplayName="Run Tests" sap:VirtualizedContainerService.HintSize="1053,2175" mtbwt:BuildTrackingParticipant.Importance="Low">
                                <sap:WorkflowViewStateService.ViewState>
                                  <scg:Dictionary x:TypeArguments="x:String, x:Object">
                                    <x:Boolean x:Key="IsExpanded">True</x:Boolean>
                                    <x:Boolean x:Key="IsPinned">False</x:Boolean>
                                  </scg:Dictionary>
                                </sap:WorkflowViewStateService.ViewState>
                                <v:SetAgentInformationNode ExceptionMessage="[String.Empty]" sap:VirtualizedContainerService.HintSize="1031,22" MSTestFailed="False" />
                                <If Condition="[Not VMWareLabWorkflowParameters.AutomatedTestSettings.TestSpecList Is Nothing]" DisplayName="If Not TestSpecs Is Nothing" sap:VirtualizedContainerService.HintSize="1031,1989" mtbwt:BuildTrackingParticipant.Importance="Low">
                                  <sap:WorkflowViewStateService.ViewState>
                                    <scg:Dictionary x:TypeArguments="x:String, x:Object">
                                      <x:Boolean x:Key="IsPinned">False</x:Boolean>
                                    </scg:Dictionary>
                                  </sap:WorkflowViewStateService.ViewState>
                                  <If.Then>
                                    <ForEach x:TypeArguments="mtbwa:TestSpec" DisplayName="For Each TestSpec in TestSpecs" sap:VirtualizedContainerService.HintSize="906,1883" mtbwt:BuildTrackingParticipant.Importance="Low" Values="[VMWareLabWorkflowParameters.AutomatedTestSettings.TestSpecList]">
                                      <sap:WorkflowViewStateService.ViewState>
                                        <scg:Dictionary x:TypeArguments="x:String, x:Object">
                                          <x:Boolean x:Key="IsPinned">False</x:Boolean>
                                        </scg:Dictionary>
                                      </sap:WorkflowViewStateService.ViewState>
                                      <ActivityAction x:TypeArguments="mtbwa:TestSpec">
                                        <ActivityAction.Argument>
                                          <DelegateInArgument x:TypeArguments="mtbwa:TestSpec" Name="spec" />
                                        </ActivityAction.Argument>
                                        <TryCatch DisplayName="Try Run Tests" sap:VirtualizedContainerService.HintSize="876,1777" mtbwt:BuildTrackingParticipant.Importance="Low">
                                          <sap:WorkflowViewStateService.ViewState>
                                            <scg:Dictionary x:TypeArguments="x:String, x:Object">
                                              <x:Boolean x:Key="IsPinned">False</x:Boolean>
                                            </scg:Dictionary>
                                          </sap:WorkflowViewStateService.ViewState>
                                          <TryCatch.Try>
                                            <If Condition="[TypeOf spec Is Microsoft.TeamFoundation.Build.Workflow.Activities.TestMetadataFileSpec]" DisplayName="If spec Is TestMetadataFileSpec" sap:VirtualizedContainerService.HintSize="858,774" mtbwt:BuildTrackingParticipant.Importance="None">
                                              <sap:WorkflowViewStateService.ViewState>
                                                <scg:Dictionary x:TypeArguments="x:String, x:Object">
                                                  <x:Boolean x:Key="IsPinned">False</x:Boolean>
                                                </scg:Dictionary>
                                              </sap:WorkflowViewStateService.ViewState>
                                              <If.Then>
                                                <Sequence DisplayName="Run MSTest for Metadata File" sap:VirtualizedContainerService.HintSize="222,668">
                                                  <Sequence.Variables>
                                                    <Variable x:TypeArguments="mtbwa:TestMetadataFileSpec" Name="testMetadataFile" />
                                                    <Variable x:TypeArguments="x:String" Name="localTestMetadata" />
                                                  </Sequence.Variables>
                                                  <sap:WorkflowViewStateService.ViewState>
                                                    <scg:Dictionary x:TypeArguments="x:String, x:Object">
                                                      <x:Boolean x:Key="IsExpanded">True</x:Boolean>
                                                      <x:Boolean x:Key="IsPinned">False</x:Boolean>
                                                    </scg:Dictionary>
                                                  </sap:WorkflowViewStateService.ViewState>
                                                  <Assign x:TypeArguments="mtbwa:TestMetadataFileSpec" DisplayName="Assign spec to testMetadataFile" sap:VirtualizedContainerService.HintSize="200,22" mtbwt:BuildTrackingParticipant.Importance="Low" To="[testMetadataFile]" Value="[DirectCast(spec, Microsoft.TeamFoundation.Build.Workflow.Activities.TestMetadataFileSpec)]" />
                                                  <mtbwa:ConvertWorkspaceItem DisplayName="Convert Server Path to Local Path" sap:VirtualizedContainerService.HintSize="200,22" mtbwt:BuildTrackingParticipant.Importance="Low" Input="[testMetadataFile.MetadataFileName]" Result="[localTestMetadata]" Workspace="[Workspace]" />
                                                  <mtbwa:MSTest Category="[testMetadataFile.CategoryFilter]" CommandLineArguments="[testMetadataFile.MSTestCommandLineArgs]" DisplayName="Run MSTest for Metadata File" Flavor="[VMWareLabWorkflowParameters.BuildDetails.Configuration.Configuration]" sap:VirtualizedContainerService.HintSize="200,22" MaxPriority="[testMetadataFile.MaximumPriority]" MinPriority="[testMetadataFile.MinimumPriority]" PathToResultsFilesRoot="[TestResultsDirectory]" Platform="[VMWareLabWorkflowParameters.BuildDetails.Configuration.Platform]" SearchPathRoot="[VMWareLabWorkflowParameters.AutomatedTestSettings.BuildDeployFolder]" TestLists="[testMetadataFile.TestLists]" TestMetadata="[localTestMetadata]" TestSettings="[String.Empty]" />
                                                </Sequence>
                                              </If.Then>
                                              <If.Else>
                                                <Sequence DisplayName="Run MSTest for Test Assemblies" sap:VirtualizedContainerService.HintSize="611,668" mtbwt:BuildTrackingParticipant.Importance="Low">
                                                  <Sequence.Variables>
                                                    <Variable x:TypeArguments="mtbwa:TestAssemblySpec" Name="testAssembly" />
                                                    <Variable x:TypeArguments="scg:IEnumerable(x:String)" Name="testAssemblies" />
                                                    <Variable x:TypeArguments="x:String" Default="[String.Empty]" Name="testFlavor" />
                                                    <Variable x:TypeArguments="x:String" Default="[String.Empty]" Name="testPlatform" />
                                                  </Sequence.Variables>
                                                  <sap:WorkflowViewStateService.ViewState>
                                                    <scg:Dictionary x:TypeArguments="x:String, x:Object">
                                                      <x:Boolean x:Key="IsExpanded">True</x:Boolean>
                                                      <x:Boolean x:Key="IsPinned">False</x:Boolean>
                                                    </scg:Dictionary>
                                                  </sap:WorkflowViewStateService.ViewState>
                                                  <Assign x:TypeArguments="mtbwa:TestAssemblySpec" DisplayName="Assign spec to testAssembly" sap:VirtualizedContainerService.HintSize="589,22" mtbwt:BuildTrackingParticipant.Importance="Low" To="[testAssembly]" Value="[DirectCast(spec, Microsoft.TeamFoundation.Build.Workflow.Activities.TestAssemblySpec)]" />
                                                  <mtbwa:FindMatchingFiles DisplayName="Find Test Assemblies" sap:VirtualizedContainerService.HintSize="589,22" mtbwt:BuildTrackingParticipant.Importance="Low" MatchPattern="[String.Format(&quot;{0}\{1}&quot;, VMWareLabWorkflowParameters.AutomatedTestSettings.BuildDeployFolder, testAssembly.AssemblyFileSpec)]" Result="[testAssemblies]" />
                                                  <If Condition="[testAssemblies.Count() &gt; 0]" DisplayName="If Test Assemblies Found" sap:VirtualizedContainerService.HintSize="589,420" mtbwt:BuildTrackingParticipant.Importance="Low">
                                                    <sap:WorkflowViewStateService.ViewState>
                                                      <scg:Dictionary x:TypeArguments="x:String, x:Object">
                                                        <x:Boolean x:Key="IsPinned">False</x:Boolean>
                                                      </scg:Dictionary>
                                                    </sap:WorkflowViewStateService.ViewState>
                                                    <If.Then>
                                                      <If Condition="[testAssembly.HasTestSettingsFile]" DisplayName="If testAssembly.HasTestSettingsFile" sap:VirtualizedContainerService.HintSize="464,314" mtbwt:BuildTrackingParticipant.Importance="Low">
                                                        <sap:WorkflowViewStateService.ViewState>
                                                          <scg:Dictionary x:TypeArguments="x:String, x:Object">
                                                            <x:Boolean x:Key="IsPinned">False</x:Boolean>
                                                          </scg:Dictionary>
                                                        </sap:WorkflowViewStateService.ViewState>
                                                        <If.Then>
                                                          <Sequence DisplayName="Find Test Settings File And Run MSTest" sap:VirtualizedContainerService.HintSize="231,208" mtbwt:BuildTrackingParticipant.Importance="Low">
                                                            <Sequence.Variables>
                                                              <Variable x:TypeArguments="x:String" Name="localTestSettings" />
                                                            </Sequence.Variables>
                                                            <sap:WorkflowViewStateService.ViewState>
                                                              <scg:Dictionary x:TypeArguments="x:String, x:Object">
                                                                <x:Boolean x:Key="IsExpanded">True</x:Boolean>
                                                                <x:Boolean x:Key="IsPinned">False</x:Boolean>
                                                              </scg:Dictionary>
                                                            </sap:WorkflowViewStateService.ViewState>
                                                            <mtbwa:ConvertWorkspaceItem DisplayName="Convert Server Path to Local Path" sap:VirtualizedContainerService.HintSize="200,22" mtbwt:BuildTrackingParticipant.Importance="Low" Input="[testAssembly.TestSettingsFileName]" Result="[localTestSettings]" Workspace="[Workspace]" />
                                                            <mtbwa:MSTest Category="[testAssembly.CategoryFilter]" CommandLineArguments="[testAssembly.MSTestCommandLineArgs]" DisplayName="Run MSTest for Test Assemblies" Flavor="[VMWareLabWorkflowParameters.BuildDetails.Configuration.Configuration]" sap:VirtualizedContainerService.HintSize="200,22" MaxPriority="[testAssembly.MaximumPriority]" MinPriority="[testAssembly.MinimumPriority]" PathToResultsFilesRoot="[TestResultsDirectory]" Platform="[VMWareLabWorkflowParameters.BuildDetails.Configuration.Platform]" SearchPathRoot="[VMWareLabWorkflowParameters.AutomatedTestSettings.BuildDeployFolder]" TestContainers="[testAssemblies]" TestSettings="[localTestSettings]" />
                                                          </Sequence>
                                                        </If.Then>
                                                        <If.Else>
                                                          <mtbwa:MSTest Category="[testAssembly.CategoryFilter]" CommandLineArguments="[testAssembly.MSTestCommandLineArgs]" DisplayName="Run MSTest for Test Assemblies" Flavor="[VMWareLabWorkflowParameters.BuildDetails.Configuration.Configuration]" sap:VirtualizedContainerService.HintSize="208,208" MaxPriority="[testAssembly.MaximumPriority]" MinPriority="[testAssembly.MinimumPriority]" PathToResultsFilesRoot="[TestResultsDirectory]" Platform="[VMWareLabWorkflowParameters.BuildDetails.Configuration.Platform]" SearchPathRoot="[VMWareLabWorkflowParameters.AutomatedTestSettings.BuildDeployFolder]" TestContainers="[testAssemblies]" />
                                                        </If.Else>
                                                      </If>
                                                    </If.Then>
                                                  </If>
                                                </Sequence>
                                              </If.Else>
                                            </If>
                                          </TryCatch.Try>
                                          <TryCatch.Catches>
                                            <Catch x:TypeArguments="s:Exception" sap:VirtualizedContainerService.HintSize="862,733">
                                              <sap:WorkflowViewStateService.ViewState>
                                                <scg:Dictionary x:TypeArguments="x:String, x:Object">
                                                  <x:Boolean x:Key="IsExpanded">False</x:Boolean>
                                                  <x:Boolean x:Key="IsPinned">False</x:Boolean>
                                                </scg:Dictionary>
                                              </sap:WorkflowViewStateService.ViewState>
                                              <ActivityAction x:TypeArguments="s:Exception">
                                                <ActivityAction.Argument>
                                                  <DelegateInArgument x:TypeArguments="s:Exception" Name="testException" />
                                                </ActivityAction.Argument>
                                                <Sequence DisplayName="Handle MSTest Exception" sap:VirtualizedContainerService.HintSize="856,700">
                                                  <sap:WorkflowViewStateService.ViewState>
                                                    <scg:Dictionary x:TypeArguments="x:String, x:Object">
                                                      <x:Boolean x:Key="IsExpanded">True</x:Boolean>
                                                    </scg:Dictionary>
                                                  </sap:WorkflowViewStateService.ViewState>
                                                  <v:SetAgentInformationNode ExceptionMessage="[testException.Message]" sap:VirtualizedContainerService.HintSize="464,22" MSTestFailed="True" />
                                                  <If Condition="[Not (TypeOf testException Is Microsoft.TeamFoundation.Build.Workflow.Activities.TestFailureException)]" DisplayName="If testException is NOT TestFailureException" sap:VirtualizedContainerService.HintSize="464,206" mtbwt:BuildTrackingParticipant.Importance="Low">
                                                    <If.Then>
                                                      <mtbwa:WriteBuildError DisplayName="Write Test Failure Exception message" sap:VirtualizedContainerService.HintSize="269,100" Message="[testException.Message]" />
                                                    </If.Then>
                                                  </If>
                                                  <mtbwa:SetBuildProperties DisplayName="Set TestStatus to Failed" sap:VirtualizedContainerService.HintSize="464,22" mtbwt:BuildTrackingParticipant.Importance="Low" PropertiesToSet="TestStatus" TestStatus="[Microsoft.TeamFoundation.Build.Client.BuildPhaseStatus.Failed]" />
                                                  <If Condition="[spec.FailBuildOnFailure]" DisplayName="If spec.FailBuildOnFailure" sap:VirtualizedContainerService.HintSize="464,206" mtbwt:BuildTrackingParticipant.Importance="Low">
                                                    <If.Then>
                                                      <Assign x:TypeArguments="x:Boolean" DisplayName="Set treatTestFailureAsBuildFailure to True" sap:VirtualizedContainerService.HintSize="269,100" mtbwt:BuildTrackingParticipant.Importance="Low" To="[treatTestFailureAsBuildFailure]" Value="[True]" />
                                                    </If.Then>
                                                  </If>
                                                </Sequence>
                                              </ActivityAction>
                                            </Catch>
                                          </TryCatch.Catches>
                                        </TryCatch>
                                      </ActivityAction>
                                    </ForEach>
                                  </If.Then>
                                </If>
                              </Sequence>
                            </If.Then>
                          </If>
                          <If Condition="[BuildDetail.TestStatus = Microsoft.TeamFoundation.Build.Client.BuildPhaseStatus.Unknown]" DisplayName="If TestStatus = Unknown" sap:VirtualizedContainerService.HintSize="1178,206" mtbwt:BuildTrackingParticipant.Importance="Low">
                            <If.Then>
                              <mtbwa:SetBuildProperties DisplayName="Set TestStatus to Succeeded" sap:VirtualizedContainerService.HintSize="269,100" mtbwt:BuildTrackingParticipant.Importance="Low" PropertiesToSet="TestStatus" TestStatus="[Microsoft.TeamFoundation.Build.Client.BuildPhaseStatus.Succeeded]" />
                            </If.Then>
                          </If>
                          <If Condition="[treatTestFailureAsBuildFailure And (BuildDetail.TestStatus = Microsoft.TeamFoundation.Build.Client.BuildPhaseStatus.Failed)]" DisplayName="If TreatTestFailureAsBuildFailure And (TestStatus = Failed)" sap:VirtualizedContainerService.HintSize="1178,206" mtbwt:BuildTrackingParticipant.Importance="Low">
                            <If.Then>
                              <mtbwa:SetBuildProperties DisplayName="Set Status to Failed" sap:VirtualizedContainerService.HintSize="269,100" mtbwt:BuildTrackingParticipant.Importance="Low" PropertiesToSet="Status" Status="[Microsoft.TeamFoundation.Build.Client.BuildStatus.Failed]" />
                            </If.Then>
                          </If>
                        </Sequence>
                      </TryCatch.Try>
                      <TryCatch.Catches>
                        <Catch x:TypeArguments="s:Exception" sap:VirtualizedContainerService.HintSize="1204,108">
                          <sap:WorkflowViewStateService.ViewState>
                            <scg:Dictionary x:TypeArguments="x:String, x:Object">
                              <x:Boolean x:Key="IsExpanded">False</x:Boolean>
                              <x:Boolean x:Key="IsPinned">False</x:Boolean>
                            </scg:Dictionary>
                          </sap:WorkflowViewStateService.ViewState>
                          <ActivityAction x:TypeArguments="s:Exception">
                            <ActivityAction.Argument>
                              <DelegateInArgument x:TypeArguments="s:Exception" Name="compilationExceptionArgument" />
                            </ActivityAction.Argument>
                            <Assign x:TypeArguments="s:Exception" DisplayName="Save the Compilation Exception" sap:VirtualizedContainerService.HintSize="1198,75" mtbwt:BuildTrackingParticipant.Importance="None" To="[compilationException]" Value="[compilationExceptionArgument]" />
                          </ActivityAction>
                        </Catch>
                      </TryCatch.Catches>
                    </TryCatch>
                  </Parallel>
                  <If Condition="[Not compilationException Is Nothing]" DisplayName="If a Compilation Exception Occurred" sap:VirtualizedContainerService.HintSize="1332,206" mtbwt:BuildTrackingParticipant.Importance="Low">
                    <If.Then>
                      <Throw DisplayName="Rethrow Compilation Exception" Exception="[compilationException]" sap:VirtualizedContainerService.HintSize="269,100" mtbwt:BuildTrackingParticipant.Importance="Low" />
                    </If.Then>
                  </If>
                </Sequence>
              </TryCatch.Try>
            </TryCatch>
          </mtbwa:AgentScope>
        </Sequence>
      </If.Then>
    </If>
    <TryCatch sap:VirtualizedContainerService.HintSize="1541,1120">
      <TryCatch.Try>
        <Sequence sap:VirtualizedContainerService.HintSize="486,742">
          <sap:WorkflowViewStateService.ViewState>
            <scg:Dictionary x:TypeArguments="x:String, x:Object">
              <x:Boolean x:Key="IsExpanded">True</x:Boolean>
            </scg:Dictionary>
          </sap:WorkflowViewStateService.ViewState>
          <InvokeMethod sap:VirtualizedContainerService.HintSize="464,130" MethodName="RefreshAllDetails">
            <InvokeMethod.TargetObject>
              <InArgument x:TypeArguments="mtbc:IBuildDetail">[BuildDetail]</InArgument>
            </InvokeMethod.TargetObject>
          </InvokeMethod>
          <Assign sap:VirtualizedContainerService.HintSize="464,58">
            <Assign.To>
              <OutArgument x:TypeArguments="v:AgentInformationNode">[RetrievedAgentInformationNode]</OutArgument>
            </Assign.To>
            <Assign.Value>
              <InArgument x:TypeArguments="v:AgentInformationNode">[New AgentInformationNode(BuildDetail.Information.GetNodesByType(AgentInformationNode.Name).First())]</InArgument>
            </Assign.Value>
          </Assign>
          <If Condition="[RetrievedAgentInformationNode.MSTestFailed]" DisplayName="If MSTest failed" sap:VirtualizedContainerService.HintSize="464,350">
            <If.Then>
              <Sequence sap:VirtualizedContainerService.HintSize="301,244">
                <sap:WorkflowViewStateService.ViewState>
                  <scg:Dictionary x:TypeArguments="x:String, x:Object">
                    <x:Boolean x:Key="IsExpanded">True</x:Boolean>
                  </scg:Dictionary>
                </sap:WorkflowViewStateService.ViewState>
                <Assign sap:VirtualizedContainerService.HintSize="242,58">
                  <Assign.To>
                    <OutArgument x:TypeArguments="mtbc:BuildStatus">[BuildStatus]</OutArgument>
                  </Assign.To>
                  <Assign.Value>
                    <InArgument x:TypeArguments="mtbc:BuildStatus">[Microsoft.TeamFoundation.Build.Client.BuildStatus.Failed]</InArgument>
                  </Assign.Value>
                </Assign>
                <mtbwa:WriteBuildError DisplayName="Write Test Failure Exception message" sap:VirtualizedContainerService.HintSize="242,22" Message="[RetrievedAgentInformationNode.MSTestExceptionMessage]" />
              </Sequence>
            </If.Then>
          </If>
        </Sequence>
      </TryCatch.Try>
      <TryCatch.Catches>
        <Catch x:TypeArguments="s:Exception" sap:VirtualizedContainerService.HintSize="490,108">
          <sap:WorkflowViewStateService.ViewState>
            <scg:Dictionary x:TypeArguments="x:String, x:Object">
              <x:Boolean x:Key="IsExpanded">True</x:Boolean>
              <x:Boolean x:Key="IsPinned">False</x:Boolean>
            </scg:Dictionary>
          </sap:WorkflowViewStateService.ViewState>
          <ActivityAction x:TypeArguments="s:Exception">
            <ActivityAction.Argument>
              <DelegateInArgument x:TypeArguments="s:Exception" Name="exception" />
            </ActivityAction.Argument>
          </ActivityAction>
        </Catch>
      </TryCatch.Catches>
    </TryCatch>
    <mtbwa:SetBuildProperties DisplayName="Set build status" sap:VirtualizedContainerService.HintSize="1541,22" PropertiesToSet="Status" Status="[BuildStatus]" />
  </Sequence>
</Activity>